package com.hrt.datasender.datadao.model;

import com.btcode.db.fieldtype.FieldType;
import com.btcode.orm.model.BaseModel;
import com.btcode.orm.model.Field;
import com.btcode.orm.model.IField;

import java.util.Date;

public class BdDeviceStateModel extends BaseModel {

    private static final long serialVersionUID = 1L;
    private static String tableName = "BD_MO_DEVICE_STATE";

    public static IField guid = new Field(BdDeviceStateModel.class, "GUID", FieldType.String, true);
    public static IField device = new Field(BdDeviceStateModel.class, "DEVICE", FieldType.String, false);
    public static IField alarm = new Field(BdDeviceStateModel.class, "ALARM", FieldType.Integer, false);
    public static IField error = new Field(BdDeviceStateModel.class, "ERROR", FieldType.Integer, false);
    public static IField status = new Field(BdDeviceStateModel.class, "STATUS", FieldType.Integer, false);
    public static IField absorbance = new Field(BdDeviceStateModel.class, "ABSORBANCE", FieldType.String, false);
    public static IField datatime = new Field(BdDeviceStateModel.class, "DATATIME", FieldType.DateTime, false);
    public static IField calibratetime = new Field(BdDeviceStateModel.class, "CALIBRATETIME", FieldType.DateTime, false);
    public static IField createtime = new Field(BdDeviceStateModel.class, "CREATETIME", FieldType.DateTime, false);

    public BdDeviceStateModel setGuid(String value) {
        setFieldValue(guid.getFieldName(), value);
        return this;
    }

    public String getGuid() {
        Object value = getFieldValue(BdDeviceStateModel.guid.getFieldName());
        return getValueConver().converToString(value);
    }

    public BdDeviceStateModel setDevice(String value) {
        setFieldValue(device.getFieldName(), value);
        return this;
    }

    public String getDevice() {
        Object value = getFieldValue(BdDeviceStateModel.device.getFieldName());
        return getValueConver().converToString(value);
    }

    public BdDeviceStateModel setAlarm(Integer value) {
        setFieldValue(alarm.getFieldName(), value);
        return this;
    }

    public Integer getAlarm() {
        Object value = getFieldValue(BdDeviceStateModel.alarm.getFieldName());
        return getValueConver().converToInteger(value);
    }

    public BdDeviceStateModel setError(Integer value) {
        setFieldValue(error.getFieldName(), value);
        return this;
    }

    public Integer getError() {
        Object value = getFieldValue(BdDeviceStateModel.error.getFieldName());
        return getValueConver().converToInteger(value);
    }

    public BdDeviceStateModel setStatus(Integer value) {
        setFieldValue(status.getFieldName(), value);
        return this;
    }

    public Integer getStatus() {
        Object value = getFieldValue(BdDeviceStateModel.status.getFieldName());
        return getValueConver().converToInteger(value);
    }

    public BdDeviceStateModel setAbsorbance(String value) {
        setFieldValue(absorbance.getFieldName(), value);
        return this;
    }

    public String getAbsorbance() {
        Object value = getFieldValue(BdDeviceStateModel.absorbance.getFieldName());
        return getValueConver().converToString(value);
    }

    public BdDeviceStateModel setDatatime(Date value) {
        setFieldValue(datatime.getFieldName(), value);
        return this;
    }

    public Date getDatatime() {
        Object value = getFieldValue(BdDeviceStateModel.datatime.getFieldName());
        return getValueConver().converToDate(value);
    }

    public BdDeviceStateModel setCalibratetimee(Date value) {
        setFieldValue(calibratetime.getFieldName(), value);
        return this;
    }

    public Date getCalibratetime() {
        Object value = getFieldValue(BdDeviceStateModel.calibratetime.getFieldName());
        return getValueConver().converToDate(value);
    }

    public BdDeviceStateModel setCreatetime(Date value) {
        setFieldValue(createtime.getFieldName(), value);
        return this;
    }

    public Date getCreatetime() {
        Object value = getFieldValue(BdDeviceStateModel.createtime.getFieldName());
        return getValueConver().converToDate(value);
    }

    public String getTableName() {
        return tableName;
    }

    public boolean isNeedCache() {
        return false;
    }

}